docs: translate module docs to Chinese (#1691)#1791
Conversation
MCP clients such as Cherry Studio always pass filter:{} in conversation
mode. FastMCP rejects unknown or invalid parameters, returning HTTP 400
"Invalid request parameters". Accept the filter parameter and normalise
an empty dict to None so the call succeeds.
Fixes MemTensor#1718
|
The CI Ruff checks are failing and need to be fixed before this can be merged:
Please run locally: poetry run ruff check --fix tests/api/test_mcp_serve.py
poetry run ruff format tests/api/test_mcp_serve.py |
|
Fixed the Ruff lint/format issues in tests/api/test_mcp_serve.py — CI should pass now. |
Memtensor-AI
left a comment
There was a problem hiding this comment.
Needs minor changes
The docs translation looks solid and the MCP fix is well-tested. A few issues worth addressing:
Code issues
1. filter parameter accepted but never used (src/memos/api/mcp_serve.py:273-299)
The filter param is added to the signature and normalized to None, but it's never passed to self.mos_core.search():
if not filter:
filter = None
result = self.mos_core.search(query, user_id, cube_ids) # filter not forwardedIf this is intentional (just to prevent MCP clients from erroring when they send filter: {}), add a comment making that explicit. If it should actually filter results, wire it through.
2. filter shadows the built-in (src/memos/api/mcp_serve.py:276)
Using filter as a parameter name shadows Python's built-in. Consider search_filter or filters instead. Minor, but it can confuse linters and developers.
3. if not filter is overly broad (src/memos/api/mcp_serve.py:297)
not filter is truthy for {}, None, [], 0, "", etc. If the intent is specifically "empty dict or None → treat as no filter," be explicit:
if filter is None or filter == {}:
filter = NoneThis avoids accidentally swallowing a filter value of 0 or False if the type annotation ever loosens.
Documentation nits
4. Typo in memos_neo.md — the embedding dimension is stated as 3027:
维度为 text-embedding-3-large(dim-size 3027)
OpenAI's text-embedding-3-large default dimension is 3072. If this is a project-specific truncation, clarify; otherwise fix the number.
5. memos_mcp.md JSON has a trailing comma (line ~96 of the new file):
"--transport", "stdio"
],
// "cwd": "/path/to/your/MemOS pip user is optional",The commented-out cwd line with // isn't valid JSON. This will confuse users who copy-paste. Either remove it or use a note outside the code block.
Test feedback
Tests are clean and cover the key cases well. One suggestion: add a test with a non-empty filter dict (e.g., filter={"tag": "work"}) to document the current behavior (that it's silently ignored). This prevents future regressions if someone later wires filter through.
PR hygiene
The PR description says "Fixes #1691" but #1691 appears to be the PR itself, not a separate issue. Double-check the linked issue number.
Overall the translation quality is good — class names and code stay in English as promised, and the prose reads naturally.
Description
Translate module documentation from English to Chinese.
Files added:
docs/cn/open_source/modules/model_backend.mddocs/cn/open_source/modules/api_deployment.mddocs/cn/open_source/modules/mos/memos_mcp.mddocs/cn/open_source/modules/mos/memos_neo.mdClass names, API names, code blocks, and command examples remain in English. Only explanatory prose is translated.
Related Issue (Required): Fixes #1691
Type of change
How Has This Been Tested?
Checklist